package com.woniuxy.controller;

import com.woniuxy.entity.dto.GoodsManagementDTO;
import com.woniuxy.service.GoodsManagementService;
import com.woniuxy.util.PageData;
import com.woniuxy.util.ResponseData;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/goods")
public class GoodsManagementController {
    @Resource
    private GoodsManagementService goodsManagementService;


    @PostMapping("/queryAllGoods")
    public ResponseData<?> queryAllGoods(@RequestBody PageData<GoodsManagementDTO> pageData) {
        return goodsManagementService.queryAllGoods(pageData);
    }


    @PostMapping("/saveAddGoods")
    public ResponseData<?> saveAddGoods(@RequestBody GoodsManagementDTO goodsManagementDTO) {
        return goodsManagementService.addGoods(goodsManagementDTO);
    }

    @PostMapping("/saveUpdateGoods")
    public ResponseData<?> saveUpdateGoods(@RequestBody GoodsManagementDTO goodsManagementDTO) {
        return goodsManagementService.updateGoods(goodsManagementDTO);
    }

    @PostMapping("/updateStatus")
    public ResponseData<?> updateStatus(@RequestBody GoodsManagementDTO goodsManagementDTO) {
        return goodsManagementService.updateStatus(goodsManagementDTO);
    }

    @PostMapping("/batchUpdateStatus1")
    public ResponseData<?> batchUpdateStatus1(@RequestBody List<GoodsManagementDTO> goodsManagementDTOS) {
        return goodsManagementService.batchUpdateStatus1(goodsManagementDTOS);
    }

    @PostMapping("/batchUpdateStatus0")
    public ResponseData<?> batchUpdateStatus0(@RequestBody List<GoodsManagementDTO> goodsManagementDTOS) {
        return goodsManagementService.batchUpdateStatus0(goodsManagementDTOS);
    }


}
